// pages/event/event.js
const app=getApp();

Page({
  user: app.user,
  data: {
    list: [
      Math.random(),
      Math.random(),
      Math.random(),
      Math.random()
    ],
    user: {
      name: "tom",
      obj: {
        a: "字符串"
      }
    }
  },
  onLoad:function(){
    console.log("第一次加载");
  },
  onReady:function(){
    console.log("渲染完成");
  },
  onShow(){
    console.log("切换显示页面");
  },
  onHide(){
    console.log("页面隐藏");
  },
  onUnload:function(){

  },
  onPullDownRefresh:function(){
    console.log("重新发送请求获取数据");
    // console.log(app);
    let temp = [
      "第一个数据",
      "第二个数据",
      "第三个数据",
      "第四个数据"
    ];
    console.log(this);
    // this.data.list=temp;
    this.setData({
      list:temp,
      user:{
        obj:{
          a:"新字符串"
        }
      }
    });
  },
  onReachBottom:function(){
    console.log("触底方法");
  },
  onShareAppMessage:function(params){
    console.log("分享被触发",params);
    return {
      title:"测试项目",
      path:"/pages/rand/rand",
      imageUrl:"../../img/about.png"
    }
  },
  printMsg:function(){
    console.log("自定义方法");
  },
  printParams:function(e){
    console.log("接收事件触发传入的参数:", e);
    console.log(e.currentTarget.dataset);
  },
  printName:function(e){
    console.log(e.currentTarget.dataset);
  }
})